
	<h1><?php echo $this->lang->line('album_title'); ?></h1>
	    <div class="toppage">
	        <span class="btnadd">
	        	<a onclick="open_form('<?php echo admin_url(); ?>/add-new-gallery-cate')" href="javascript:void(0)"><?php echo $this->lang->line('add'); ?></a>
	        </span>
	    </div>
     <form action="<?php echo admin_url();?>/gallery-cate/" method="post" id="list-group-form">
	     <div class="topart">
	    	<span class="left">
	    		<?php 
	    			$total_amount	=	$this->group_model->count_all();
	    		?>
	    		<font class="number">(<?php echo $total_amount;?>)</font>
	    		<a href="javascript:void(0);" ><?php echo $this->lang->line('all'); ?></a>
	        </span>
	        <span class="right1">
	        	<select style="width:50px;" name="perpage" id="perpage" onchange="changePageNumber()">
	            	<option value="6" <?php echo ($current_perpage==6)?'selected':'';?>>6</option>
	                <option value="12" <?php echo ($current_perpage==12)?'selected':'';?>>12</option>
	                <option value="24" <?php echo ($current_perpage==24)?'selected':'';?>>24</option>
	                <option value="all" <?php echo ($current_perpage=='all')?'selected':'';?>><?php echo $this->lang->line('all'); ?></option>
	            </select>
	            <div class="pagination">
	                <?php if(isset($pagination)){echo $pagination;}?>
	            </div>
		    </span>
	    </div>
    </form>
    <div class="tableout">
    	<form action="<?php echo admin_url();?>/gallery-cate/do-action" method="post" id="action_group_form">
			<div class="title1">
	        	<div class="column" style="width: 2%;"><input class="check_all" onclick="check_all('.check_all')" type="checkbox"></div>
	            <div class="column" style="width: 4%;"><?php echo $this->lang->line('number'); ?></div>
	            <div class="column" style="width: 25%;"><?php echo $this->lang->line('name'); ?></div>
	            <div class="column" style="width: 55%;"><?php echo $this->lang->line('description'); ?></div>
	            <div class="column" style="width: 8%;"><?php echo $this->lang->line('order'); ?></div>
	        </div>
	        <?php if(count($group_list[0])>0){?>
	        <?php foreach ($group_list as $k => $v){?>
	        <div class="linecate2">
	        	<div class="column" style="width: 2%;"><input name="id[]" value="<?php echo $v->id;?>" type="checkbox" /></div>
	            <div class="column" style="width:4%;"><?php echo $k+1;?></div>
	            
	            <div id="row_<?php echo $v->id;?>">
		            <div class="column" style="width:25%;" onmouseover="Hovercat('<?php echo $v->id;?>')" onmouseout="Outcat('<?php echo $v->id;?>')">
		            	<a href="javascript:;" class="art ">
		            		<?php 
    							$content = $v->name;
		            			echo $content;
		            		?>
		            	</a><br />
		                <div class="action" id="neocat-<?php echo $v->id;?>">
		                    <img src="<?php echo base_url();?>public/admin/img/edit.gif" /><a href="javascript:void(0)" onclick="open_form('<?php echo admin_url(); ?>/edit-gallery-cate/<?php echo $v->id;?>')"><?php echo $this->lang->line('edit'); ?></a>|<img src="<?php echo base_url();?>public/admin/img/delete.gif" /><a href="<?php echo admin_url();?>/delete-gallery-cate/<?php echo $v->id;?>" onclick="return confirm('<?php echo $this->lang->line('delete_conf'); ?>');"><font color="#be0000"><?php echo $this->lang->line('delete'); ?></font></a>
		                </div>
		            </div>
		            <div class="column" style="width:55%;">
		            	<?php 
    							$content = $v->description;
		            			$content = strip_tags($content);
		            			if(strlen($content) > 80){
		            				$content = substr($content,0,80);
		            				$posw=strrpos($content," ");
		            				if($posw > 0)$content = substr($content,0,$posw);
		            				echo $content.'...';
		            			}else {
		            				echo $content;
		            			}
		            		?>
		            </div>
		           
		            <div class="column" style="width:8%;">
		            	<input type="text" name="order" class="order" id="<?php echo $v->id;?>" value="<?php echo $v->order;?>" maxlength="4" style="width:45px; float:left;" />
		            </div>
		            
	            </div>
	        </div>
	        <?php }?>
	        <?php }else{?>
	        	<p style="padding: 10px;font-size: 16px; font-style: italic; color: green;" ><?php echo $this->lang->line('no_results'); ?></p>
	        <?php }?>
	        <div class="bottom1">
	        	<div class="column" style="width: 2%;"><input class="check_all" onclick="check_all(this)" type="checkbox"></div>
	             <span class="right1">
	                <div class="pagination">
	                	<?php if(isset($pagination)){echo $pagination;}?>
	            	</div>
	            </span>
	        </div>
        </form>
	</div>
	
<script type="text/javascript">
	function changePageNumber() {
		$("#list-group-form").submit();
	}
	var inform	=	'<?php echo $inform;?>';
	if(inform == 'delete group success') {alert("<?php echo $this->lang->line('delete_mess'); ?>");}

	
	$('#action_group_form').iframer({
	    onComplete: function(msg){
	    	if(msg == 'yes') {
		    	alert('<?php echo $this->lang->line('action_mess'); ?>');
	    		window.location	=	'<?php echo $current_url;?>';
	    	}
	    	else show_error('div_message', msg)
	    }
	});

	
	$(function(){
		$('.order').keydown(function(event){
        	if ( event.keyCode == 46 || event.keyCode == 8 ) {
                // let it happen, don't do anything
            }else{
                // Ensure that it is a number and stop the keypress
                if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )) {
                    event.preventDefault(); 
                }   
            }
			
            if(event.keyCode == 13) { // Enter pressed
            	alert("<?php echo $this->lang->line('order_mess');?>");
	            var group_order = $(this).val(); 
	            var group_id = $(this).attr('id');
	            $('input[name="group_id"]').val(group_id);
	            $('input[name="group_order"]').val(group_order);
	            $('#change_order_group').submit();
        	}
        });
	})
</script>
<?php
    echo form_open(admin_url('gallery-cate/change-order'), array('id' => 'change_order_group'), array('group_id' => 0, 'group_order' => 0));
    echo form_close();
?>

	